//
//  DZBaseTableViewController.swift
//  dazhanweibo
//
//  Created by apple on 16/2/28.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class DZBaseTableViewController: UITableViewController {

    var userLogin = false
    
    lazy var vistorView: VisitorView = VisitorView()
    
    override func loadView() {
        userLogin ? super.loadView(): setupVisitorView()
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        
        
        
        
    }
    
    private func setupVisitorView(){
        
        vistorView = VisitorView()
        view = vistorView
//        view.backgroundColor = UIColor.grayColor()
        if self is DZHomeViewController{
            vistorView.startRotationAnimation()
            
        }else if self is DZMessageViewController{
            vistorView.setupVisitorInfo("visitordiscover_image_message", message: "登录后，别人评论你的微博，发给你的消息，都会在这里收到通知")
            
        }else if self is DZDiscoverViewController{
            vistorView.setupVisitorInfo("visitordiscover_image_message", message: "登录后，最新、最热微博尽在掌握，不再会与实事潮流擦肩而过")
            
        }else if self is DZProfileViewController{
            vistorView.setupVisitorInfo("visitordiscover_image_profile", message: "登录后，你的微博、相册、个人资料会显示在这里，展示给别人")
            
        }
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "vistorViewRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "vistorViewLogin")
        
        vistorView.vistorViewDelegate = self
    }



}

extension DZBaseTableViewController :VistorViewDelegate {
    
    func vistorViewRegister() {
        print("register")
    }
    
    func vistorViewLogin() {
        print("login")
    }
}
